package chenji.yourticket.pricecalculator;

import java.util.HashMap;

import org.bukkit.entity.Player;

public class VIPDiscountManager {
	public HashMap<String, Double> miao = new HashMap<String, Double>();
	
	public void addVipDiscount(String PermissionName, double discount) {
		this.miao.put(PermissionName, discount);

	}

	public double getDiscount(Player p) {
		double nowDiscount = 1.0D;
	

		for (String s : miao.keySet()) {
			if (p.hasPermission("YourTicket.VIPDiscount." + s)) {
				if (nowDiscount > miao.get(s)) {
					nowDiscount = miao.get(s);
				}
			}
		}
		return nowDiscount;
	}
	public String getGroup(Player p){
	String sa = null;
	double nowDiscount = 1.0D;
		for (String s : miao.keySet()) {
			if (p.hasPermission("YourTicket.VIPDiscount." + s)) {
				if (nowDiscount > miao.get(s)) {
					sa = s;
				}
			}
		}
		return sa;
	}

	
}
